home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 2000 July: Mac OS SDK / Dev.CD Jul 00 SDK2.toast / Development Kits / Cross Platform / QuickTime 4.1.2 Windows SDK / CIncludes / Processes.h < prev    next >
Encoding:
C/C++ Source or Header  |  2000-04-12  |  9.3 KB  |  295 lines  |  [TEXT/R*ch]

  1. /*
  2.      File:        Processes.h
  3.  
  4.      Contains:    Process Manager Interfaces.
  5.  
  6.      Version:    Technology:    Mac OS 8
  7.                  Release:    QuickTime 4.1
  8.  
  9.      Copyright:    (c) 1989-1999 by Apple Computer, Inc., all rights reserved
  10.  
  11.      Bugs?:        For bug reports, consult the following page on
  12.                  the World Wide Web:
  13.  
  14.                      http://developer.apple.com/bugreporter/
  15.  
  16. */
  17. #ifndef __PROCESSES__
  18. #define __PROCESSES__
  19.  
  20. #ifndef __MACTYPES__
  21.     #include <MacTypes.h>
  22. #endif
  23.  
  24. #ifndef __EVENTS__
  25.     #include <Events.h>
  26. #endif
  27.  
  28. #ifndef __FILES__
  29.     #include <Files.h>
  30. #endif
  31.  
  32.  
  33.  
  34.  
  35. #if PRAGMA_ONCE
  36. #pragma once
  37. #endif
  38.  
  39. #ifdef __cplusplus
  40. extern "C" {
  41. #endif
  42.  
  43. #if PRAGMA_IMPORT
  44. #pragma import on
  45. #endif
  46.  
  47. #if PRAGMA_STRUCT_ALIGN
  48.     #pragma options align=mac68k
  49. #elif PRAGMA_STRUCT_PACKPUSH
  50.     #pragma pack(push, 2)
  51. #elif PRAGMA_STRUCT_PACK
  52.     #pragma pack(2)
  53. #endif
  54.  
  55. /* type for unique process identifier */
  56.  
  57. struct ProcessSerialNumber {
  58.     unsigned long                     highLongOfPSN;
  59.     unsigned long                     lowLongOfPSN;
  60. };
  61. typedef struct ProcessSerialNumber        ProcessSerialNumber;
  62. typedef ProcessSerialNumber *            ProcessSerialNumberPtr;
  63. enum {
  64.                                                                 /* Process identifier - Various reserved process serial numbers */
  65.     kNoProcess                    = 0,
  66.     kSystemProcess                = 1,
  67.     kCurrentProcess                = 2
  68. };
  69.  
  70. /* Definition of the parameter block passed to _Launch */
  71. /* Typedef and flags for launchControlFlags field*/
  72.  
  73. typedef unsigned short                     LaunchFlags;
  74. enum {
  75.     launchContinue                = 0x4000,
  76.     launchNoFileFlags            = 0x0800,
  77.     launchUseMinimum            = 0x0400,
  78.     launchDontSwitch            = 0x0200,
  79.     launchAllow24Bit            = 0x0100,
  80.     launchInhibitDaemon            = 0x0080
  81. };
  82.  
  83. /* Format for first AppleEvent to pass to new process.  The size of the overall
  84.   buffer variable: the message body immediately follows the messageLength */
  85.  
  86. struct AppParameters {
  87.     EventRecord                     theMsgEvent;
  88.     unsigned long                     eventRefCon;
  89.     unsigned long                     messageLength;
  90. };
  91. typedef struct AppParameters            AppParameters;
  92. typedef AppParameters *                    AppParametersPtr;
  93. /* Parameter block to _Launch */
  94.  
  95. struct LaunchParamBlockRec {
  96.     unsigned long                     reserved1;
  97.     unsigned short                     reserved2;
  98.     unsigned short                     launchBlockID;
  99.     unsigned long                     launchEPBLength;
  100.     unsigned short                     launchFileFlags;
  101.     LaunchFlags                     launchControlFlags;
  102.     FSSpecPtr                         launchAppSpec;
  103.     ProcessSerialNumber             launchProcessSN;
  104.     unsigned long                     launchPreferredSize;
  105.     unsigned long                     launchMinimumSize;
  106.     unsigned long                     launchAvailableSize;
  107.     AppParametersPtr                 launchAppParameters;
  108. };
  109. typedef struct LaunchParamBlockRec        LaunchParamBlockRec;
  110.  
  111. typedef LaunchParamBlockRec *            LaunchPBPtr;
  112. /* Set launchBlockID to extendedBlock to specify that extensions exist.
  113.  Set launchEPBLength to extendedBlockLen for compatibility.*/
  114. enum {
  115.     extendedBlock                = 0x4C43,                        /* 'LC' */
  116.     extendedBlockLen            = sizeof(LaunchParamBlockRec) - 12
  117. };
  118.  
  119. enum {
  120.                                                                 /* Definition of the information block returned by GetProcessInformation */
  121.     modeReserved                = 0x01000000,
  122.     modeControlPanel            = 0x00080000,
  123.     modeLaunchDontSwitch        = 0x00040000,
  124.     modeDeskAccessory            = 0x00020000,
  125.     modeMultiLaunch                = 0x00010000,
  126.     modeNeedSuspendResume        = 0x00004000,
  127.     modeCanBackground            = 0x00001000,
  128.     modeDoesActivateOnFGSwitch    = 0x00000800,
  129.     modeOnlyBackground            = 0x00000400,
  130.     modeGetFrontClicks            = 0x00000200,
  131.     modeGetAppDiedMsg            = 0x00000100,
  132.     mode32BitCompatible            = 0x00000080,
  133.     modeHighLevelEventAware        = 0x00000040,
  134.     modeLocalAndRemoteHLEvents    = 0x00000020,
  135.     modeStationeryAware            = 0x00000010,
  136.     modeUseTextEditServices        = 0x00000008,
  137.     modeDisplayManagerAware        = 0x00000004
  138. };
  139.  
  140. /* Record returned by GetProcessInformation */
  141.  
  142. struct ProcessInfoRec {
  143.     unsigned long                     processInfoLength;
  144.     StringPtr                         processName;
  145.     ProcessSerialNumber             processNumber;
  146.     unsigned long                     processType;
  147.     OSType                             processSignature;
  148.     unsigned long                     processMode;
  149.     Ptr                             processLocation;
  150.     unsigned long                     processSize;
  151.     unsigned long                     processFreeMem;
  152.     ProcessSerialNumber             processLauncher;
  153.     unsigned long                     processLaunchDate;
  154.     unsigned long                     processActiveTime;
  155.     FSSpecPtr                         processAppSpec;
  156. };
  157. typedef struct ProcessInfoRec            ProcessInfoRec;
  158. typedef ProcessInfoRec *                ProcessInfoRecPtr;
  159. /* Record corresponding to the SIZE resource definition */
  160.  
  161. struct SizeResourceRec {
  162.     unsigned short                     flags;
  163.     unsigned long                     preferredHeapSize;
  164.     unsigned long                     minimumHeapSize;
  165. };
  166. typedef struct SizeResourceRec            SizeResourceRec;
  167. typedef SizeResourceRec *                SizeResourceRecPtr;
  168. typedef SizeResourceRecPtr *            SizeResourceRecHandle;
  169.                                                                                             #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  170.                                                                                             #pragma parameter __D0 LaunchApplication(__A0)
  171.                                                                                             #endif
  172. EXTERN_API( OSErr )
  173. LaunchApplication                (LaunchPBPtr             LaunchParams)                        ONEWORDINLINE(0xA9F2);
  174.  
  175. EXTERN_API( OSErr )
  176. LaunchDeskAccessory                (const FSSpec *            pFileSpec,
  177.                                  ConstStr255Param         pDAName)                            THREEWORDINLINE(0x3F3C, 0x0036, 0xA88F);
  178.  
  179. #if TARGET_OS_MAC
  180.     #define MacGetCurrentProcess GetCurrentProcess
  181. #endif
  182. EXTERN_API( OSErr )
  183. MacGetCurrentProcess            (ProcessSerialNumber *    PSN)                                THREEWORDINLINE(0x3F3C, 0x0037, 0xA88F);
  184.  
  185. EXTERN_API( OSErr )
  186. GetFrontProcess                    (ProcessSerialNumber *    PSN)                                FIVEWORDINLINE(0x70FF, 0x2F00, 0x3F3C, 0x0039, 0xA88F);
  187.  
  188. EXTERN_API( OSErr )
  189. GetNextProcess                    (ProcessSerialNumber *    PSN)                                THREEWORDINLINE(0x3F3C, 0x0038, 0xA88F);
  190.  
  191. EXTERN_API( OSErr )
  192. GetProcessInformation            (const ProcessSerialNumber * PSN,
  193.                                  ProcessInfoRec *        info)                                THREEWORDINLINE(0x3F3C, 0x003A, 0xA88F);
  194.  
  195. EXTERN_API( OSErr )
  196. SetFrontProcess                    (const ProcessSerialNumber * PSN)                            THREEWORDINLINE(0x3F3C, 0x003B, 0xA88F);
  197.  
  198. EXTERN_API( OSErr )
  199. WakeUpProcess                    (const ProcessSerialNumber * PSN)                            THREEWORDINLINE(0x3F3C, 0x003C, 0xA88F);
  200.  
  201. EXTERN_API( OSErr )
  202. SameProcess                        (const ProcessSerialNumber * PSN1,
  203.                                  const ProcessSerialNumber * PSN2,
  204.                                  Boolean *                result)                                THREEWORDINLINE(0x3F3C, 0x003D, 0xA88F);
  205.  
  206. /*    ExitToShell was previously in SegLoad.h*/
  207. EXTERN_API( void )
  208. ExitToShell                        (void)                                                        ONEWORDINLINE(0xA9F4);
  209.  
  210. /*
  211.    LaunchControlPanel is similar to LaunchDeskAccessory, but for Control Panel files instead.
  212.    It launches a control panel in an application shell maintained by the Process Manager.
  213. */
  214. EXTERN_API( OSErr )
  215. LaunchControlPanel                (const FSSpec *            pFileSpec)                            THREEWORDINLINE(0x3F3C, 0x007B, 0xA88F);
  216.  
  217. /* Values of the 'message' parameter to a Control Panel 'cdev' */
  218. enum {
  219.     initDev                        = 0,                            /*Time for cdev to initialize itself*/
  220.     hitDev                        = 1,                            /*Hit on one of my items*/
  221.     closeDev                    = 2,                            /*Close yourself*/
  222.     nulDev                        = 3,                            /*Null event*/
  223.     updateDev                    = 4,                            /*Update event*/
  224.     activDev                    = 5,                            /*Activate event*/
  225.     deactivDev                    = 6,                            /*Deactivate event*/
  226.     keyEvtDev                    = 7,                            /*Key down/auto key*/
  227.     macDev                        = 8,                            /*Decide whether or not to show up*/
  228.     undoDev                        = 9,
  229.     cutDev                        = 10,
  230.     copyDev                        = 11,
  231.     pasteDev                    = 12,
  232.     clearDev                    = 13,
  233.     cursorDev                    = 14
  234. };
  235.  
  236. /* Special values a Control Panel 'cdev' can return */
  237. enum {
  238.     cdevGenErr                    = -1,                            /*General error; gray cdev w/o alert*/
  239.     cdevMemErr                    = 0,                            /*Memory shortfall; alert user please*/
  240.     cdevResErr                    = 1,                            /*Couldn't get a needed resource; alert*/
  241.     cdevUnset                    = 3                                /* cdevValue is initialized to this*/
  242. };
  243.  
  244. /* Control Panel Default Proc */
  245. typedef CALLBACK_API( long , ControlPanelDefProcPtr )(short message, short item, short numItems, short cPanelID, EventRecord *theEvent, long cdevValue, DialogPtr cpDialog);
  246. typedef STACK_UPP_TYPE(ControlPanelDefProcPtr)                     ControlPanelDefUPP;
  247. #if OPAQUE_UPP_TYPES
  248.     EXTERN_API(ControlPanelDefUPP)
  249.     NewControlPanelDefUPP           (ControlPanelDefProcPtr    userRoutine);
  250.  
  251.     EXTERN_API(void)
  252.     DisposeControlPanelDefUPP       (ControlPanelDefUPP        userUPP);
  253.  
  254.     EXTERN_API(long)
  255.     InvokeControlPanelDefUPP       (short                    message,
  256.                                     short                    item,
  257.                                     short                    numItems,
  258.                                     short                    cPanelID,
  259.                                     EventRecord *            theEvent,
  260.                                     long                    cdevValue,
  261.                                     DialogPtr                cpDialog,
  262.                                     ControlPanelDefUPP        userUPP);
  263.  
  264. #else
  265.     enum { uppControlPanelDefProcInfo = 0x000FEAB0 };                 /* pascal 4_bytes Func(2_bytes, 2_bytes, 2_bytes, 2_bytes, 4_bytes, 4_bytes, 4_bytes) */
  266.     #define NewControlPanelDefUPP(userRoutine)                         (ControlPanelDefUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppControlPanelDefProcInfo, GetCurrentArchitecture())
  267.     #define DisposeControlPanelDefUPP(userUPP)                         DisposeRoutineDescriptor(userUPP)
  268.     #define InvokeControlPanelDefUPP(message, item, numItems, cPanelID, theEvent, cdevValue, cpDialog, userUPP)  (long)CALL_SEVEN_PARAMETER_UPP((userUPP), uppControlPanelDefProcInfo, (message), (item), (numItems), (cPanelID), (theEvent), (cdevValue), (cpDialog))
  269. #endif
  270. /* support for pre-Carbon UPP routines: NewXXXProc and CallXXXProc */
  271. #define NewControlPanelDefProc(userRoutine)                     NewControlPanelDefUPP(userRoutine)
  272. #define CallControlPanelDefProc(userRoutine, message, item, numItems, cPanelID, theEvent, cdevValue, cpDialog) InvokeControlPanelDefUPP(message, item, numItems, cPanelID, theEvent, cdevValue, cpDialog, userRoutine)
  273.  
  274.  
  275. #if PRAGMA_STRUCT_ALIGN
  276.     #pragma options align=reset
  277. #elif PRAGMA_STRUCT_PACKPUSH
  278.     #pragma pack(pop)
  279. #elif PRAGMA_STRUCT_PACK
  280.     #pragma pack()
  281. #endif
  282.  
  283. #ifdef PRAGMA_IMPORT_OFF
  284. #pragma import off
  285. #elif PRAGMA_IMPORT
  286. #pragma import reset
  287. #endif
  288.  
  289. #ifdef __cplusplus
  290. }
  291. #endif
  292.  
  293. #endif /* __PROCESSES__ */
  294.  
  295.